import request from '@/plugins/request';
// 工具列表
export function toolList(data) {
    return request({
      url: "/v1/buss/tool/list",
      method: "get",
      params: data,
    });
}
  
  //新增工具
export function createTool(data) {
    return request({
        url: "/v1/buss/tool/create",
        method: "post",
        data,
    });
}

//删除工具
export function deleteTool(data) {
    return request({
        url: "/v1/buss/tool/delete",
        method: "post",
        data,
    });
}

// 工具详情
export function toolInfo(data) {
    return request({
      url: "/v1/buss/tool/info",
      method: "get",
      params: data,
    });
}
  
//编辑工具
export function updateTool(data) {
    return request({
        url: "/v1/buss/tool/update",
        method: "post",
        data,
    });
}

// 检验标签名是否正常
export function checkTgaStatus(data) {
    return request({
      url: "/v1/base/tags/check-status",
      method: "get",
      params: data,
    });
}
//上传文件
export function uploadFile(data,that) {
    return request({
        url: "/common/file/upload",
        method: "post",
        isUpload:true,
        data, 
        signal:that.controller.signal,
        onUploadProgress:function(e){
            that.progress=parseInt(e.loaded/e.total*100) 
        }
    });
  }
  //上传视频
export function uploadVideo(data,that) {
    return request({
        url: "/common/file/upload",
        method: "post",
        isUpload:true,
        data, 
        signal:that.controller2.signal,
    });
  }
//上传文件
export function uploadImg(data,that) {
    return request({
        url: "/common/file/upload",
        method: "post",
        isUpload:true,
        data, 
        signal:that.controller1.signal
    });
  }

  // 工具分类列表

export function categoryList(data) {
    return request({
      url: "/v1/buss/tool/category-list",
      method: "get",
      params: data,
    });
}
  // 工具编辑详情

  export function toolEditInfo(data) {
    return request({
      url: "/v1/buss/tool/edit-info",
      method: "get",
      params: data,
    });
}
  // 下载【附件 or 图片\视频】

  export function toolDownLoad(data) {
    return request({
      url: "/v1/buss/tool/download",
      method: "get",
      params: data,
    });
}